<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        class Person{
            constructor(name, age){
                this.name = name;
                this.age = age; 
            }
            getName(){
                console.log(this.name)
            }

            //静态方法也可被继承，但调用要类来调用 
            static getInfor(){
                console.log("你好");
            }
        }

        //使用extends继承父类
        class Student extends Person{
            //es6规定，子类必须在constructor()方法中调用super(),super里写上父类属性
            constructor(name, age, jobs){
                super(name, age)
                this.jobs = jobs;
            }
        }

        var s = new Student("iwen", 15);
        s.getName();
        Student.getInfor();
    </script>
</body>
</html>